import { useDispatch } from 'react-redux';
import { Dispatch } from 'redux';

export default function useToast() {
  let dispatch = useDispatch<Dispatch<IToastAction>>();
  return (type: ToastType, message: string) => {
    dispatch({
      type: 'Toast_show',
      payload: {
        type,
        message,
      },
    });
  };
}
export { useToast };
